package com.yiji.fintech.musfinance.common.enums;

import com.google.common.collect.Maps;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 托管模式枚举
 * Created by ouwen@yiji.com} on 2017/7/24.
 */
public enum TrustModelEnum {

    TRUST("TRUST","托管模式(托管秘钥)"),
    UNTRUST("UNTRUST","非托管模式(大账户模式)");

    private String code;
    private String message;

    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    TrustModelEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }
    public static TrustModelEnum getByCode(String code) {
        for (TrustModelEnum _enum : values()) {
            if (_enum.getCode().equals(code)) {
                return _enum;
            }
        }
        return null;
    }
    public static List<TrustModelEnum> getAllEnum() {
        List<TrustModelEnum> list = new ArrayList<>();
        for (TrustModelEnum _enum : values()) {
            list.add(_enum);
        }
        return list;
    }
    public static Map<String, String> mapping() {
        Map<String, String> map = Maps.newLinkedHashMap();
        for (TrustModelEnum type : values()) {
            map.put(type.getCode(), type.getMessage());
        }
        return map;
    }
}
